using UnityEngine;
namespace Fusion.Utilities.Counters
{
    public class CounterActive : Counter
    {
        GameObject gameObject = null;
        public CounterActive(GameObject gameObject)
        {
            this.gameObject = gameObject;

            gameObject.SetActive(false);
            AddAction(delegate (int activeCount, int delta)
            {
                this.gameObject.SetActive(activeCount > 0);
            });
        }

        public void SetActive(bool value)
        {
            Count(value ? 1 : -1);
        }
    }
}
